home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / Extras / player2.1opus5 / arexx / PlayHifi_DT.dopus5 < prev    next >
Text File  |  1995-09-22  |  5KB  |  144 lines

  1. /* Programm: PlayHifi_DT.dopus5
  2. ** $VER: PlayHifi_DT.dopus5 1.0 (25-Sep-95)
  3. **
  4. ** 
  5. ** Needed: Directory Opus V5.xx (© by Jonathan Potter & GPSoftware)
  6. **         mpega (© 1995 by Stephane Tavenard) or/and 
  7. **         PeggyPlus MPEG-Card (© Ingenierbuero Helfrich)
  8. **         PeggyPlus:MPEGPlayer >= V4.7
  9. **         Play16 (© 1995 by Thomas Wenzel)
  10. **         PlayADPCM (Autor Christian Buchner)
  11. **
  12. ** Copyright © 1995 Eckhard Ludwig (Eckhard@top.east.de)
  13. ** PlayHifi_DT.dopus5 is freeware. It may be distributed freely.
  14. **
  15. ** Play compressed sound (MPEG Layer 1&2) from DOpus5. Only for DOpus5-filetypes,
  16. ** New: Play AIFF, WAVE, 8SVX, VOC, ADPCM3 (set filetypes doubleclick).
  17. **
  18. ** Localecatalog for german & more: used catalog "PlayHifi.dopus5" !
  19. **
  20. **
  21. ** Call as:
  22. ** --------------------------------------------------------------------------
  23. ** (Doubleklick)   ARexx DOpus5:ARexx/PlayHifi_DT.dopus5 {f} {Qp} {Ql}
  24. ** --------------------------------------------------------------------------
  25. ** Set Attribut: "Output to window" (Ausgabe in Fenster).
  26. ** Set Attribut: "Run asynchron" (Asynchroner Start)
  27. **
  28. */
  29.  
  30. /*- Path to Player command --------------------------------------------*/
  31. Play16 = "C:Play16"
  32. PlayADPCM = "C:PlayADPCM"
  33.  
  34. /*- Path to MPEGPlayer command ----------------------------------------*/
  35. PlayMPEG = "C:mpega"   /* Softwareplayer */
  36. MPEGA_OPTIONS=" -p -f0 -d2 -q2 "  /* edit options for your system ! */
  37.  
  38.  
  39. parse arg '"' Titel '"' portname handle
  40.  
  41. if portname='' then
  42.    portname='DOPUS.1'
  43. address value portname
  44.  
  45. options results
  46. options failat 21
  47. lf='0a'x
  48.  
  49. Index  = 'T:PlayDOpus5Index.temp' /*Name entspricht PlayHifi.dopus5 !*/
  50.  
  51. if ~show('l','rexxsupport.library') then
  52.     call addlib('rexxsupport.library',0,-30,0)
  53.  
  54. /* init locale */
  55. if ~show(l,'locale.library') then
  56.         call addlib('locale.library',0,-30)
  57. if show(l,'locale.library') then
  58.         catalog=opencatalog('PlayHifi.catalog','english',0)
  59.  
  60. if exists(Index) then do 
  61.    if ~delete(Index) then do
  62.       Index=Index||'1'
  63.       if exists(Index) then call open('output',Index,'A')
  64.        else do
  65.           if open('output',Index,'w') ~=1 then do
  66.              dopus request '"'getcatstr(3,'Error:'lf'Load script in to editor and set path to Index !')'"' getcatstr(1,'Quit')
  67.              exit
  68.              end
  69.        end
  70.    APOS=lastpos("/",Titel)
  71.    if APOS=0 then APOS=lastpos(":",Titel)   
  72.    songname=substr(Titel,APOS+1)
  73.    lister query handle entry '"'songname'"' stem fileinfo.
  74.    call writeln('output',Titel' @SIZE='fileinfo.size' @COMMENT='fileinfo.comment)
  75.    call close('output')
  76.    dopus front 
  77.    dopus request '"'getcatstr(14,'Songs added to playlist')'"' 'OK'
  78.    exit
  79.    end
  80. end
  81.  
  82. dopus getfiletype '"'Titel'"' id
  83. DT=result
  84. if DT="MP2" then do
  85.    if showlist("A","PEGGYPLUS")=1 then do
  86.       if ~show('P','Peggy') then do
  87.         address command 'stack 8192'
  88.         address command 'RUN >NIL: <NIL: PEGGYPLUS:MPEGPlayer'
  89.         address command 'waitforport Peggy'
  90.         address value portname
  91.         dopus front
  92.       end
  93.    end
  94.     if show('P','Peggy') then do
  95.       address 'Peggy'
  96.       open '"'Titel'"'
  97.       setwindow XOFF 0 YOFF 0 WIDTH 1 HEIGHT 1 XPIC 0 YPIC 0
  98.       Play async
  99.       end
  100.    else do
  101.            if ~exists(PlayMPEG) then do
  102.              dopus front
  103.              dopus request '"'getcatstr(9,'Error:'lf'MPEG-Player not found !'lf'path to command: '"'%s'"'',PlayMPEG)'"' getcatstr(1,'Quit')
  104.               exit
  105.              end
  106.       address command PlayMPEG||MPEGA_OPTIONS||'"'Titel'"'
  107.       end
  108. exit
  109. end
  110.  
  111. if DT="ADPCM3" then do
  112.     if ~exists(PlayADPCM) then do
  113.           dopus front
  114.           dopus request '"'getcatstr(10,'Error:'lf'ADPCM-Player not found !'lf'path to command: '"'%s'"'',PlayADPCM)'"' getcatstr(1,'Quit')
  115.           end
  116.    else address command PlayADPCM '"'Titel'"' " NOFILTER"
  117.    exit
  118. end
  119.  
  120. if ~exists(Play16) then do
  121.           dopus front
  122.           dopus request '"'getcatstr(11,'Error:'lf'Play16 not found !'lf'path to command: '"'%s'"'',Play16)'"' getcatstr(1,'Quit')
  123.       exit
  124.           end
  125. select
  126.    when DT="CDR" then address command Play16 '"'Titel'"' " RAW FREQ=44100 TRACKS=2 BITS=16 INTEL FAST Paula14c FILTER=OFF VERBOSITY=1"
  127.    when DT="WAVE" then address command Play16 '"'Titel'"' " FAST Paula14c FILTER=OFF VERBOSITY=1"
  128.    when DT="AIFF" then address command Play16 '"'Titel'"' " FAST Paula14c FILTER=OFF VERBOSITY=1"
  129.    otherwise address command Play16 '"'Titel'"' "FILTER=OFF VERBOSITY=1"
  130. end
  131. exit
  132.  
  133. /*--------------------------------------------------------------------------------*/
  134. getcatstr:
  135.    parse arg msgno,msgstring,insert.1,insert.2
  136.    if catalog~=0 then msgstring=getcatalogstr(catalog,msgno,msgstring)
  137.    j=0
  138.    do while pos('%s',msgstring)>0
  139.       parse var msgstring fore '%s' aft
  140.       j=j+1
  141.       msgstring=fore||insert.j||aft
  142.       end
  143.    return msgstring
  144.